<?php include THEMES_PATH.'public/before_body2.phtml';?>
</head>
<body>
<?php include THEMES_PATH.'public/header2.phtml';?>
<div class="banner js-banner">
  <img src="<?php echo $categoryImg;?>" alt="商品分类">
  <h1>
  <?php
    $cid = $_GET['cids'];
    if(!$url_type){
        switch($cid){
            case '2093':
                echo L('2093_banner_tips');
                break;
            case '2061':
                echo L('2061_banner_tips');
                break;
            case '2104':
                echo L('2104_banner_tips');
                break;
            default:
                echo $categoryname;
                break;
        }
    }else{
        echo L('_NEW_');
    }
  ?>
  </h1>
</div>
<?php
  $menuList = CategoryModel::get_category_list_base(1, 0);
  $cat_sub_list = CategoryModel::get_category_sub_list($cid);
  if(!$cat_sub_list && $has_parent_id) {
    $has_sub_list = CategoryModel::get_category_sub_list($has_parent_id['parent_id']);
  }
  if(count($cat_sub_list) > 1 || count($has_sub_list)) {//如果有大于一个子分类或有父级分类
?>
<div class="sort-nav">
    <div class="sort js-sort">
        <ul class="clearfix main-width">
            <?php
            if($menuList){
                foreach($menuList as $menu){
                    if($menu['parentid']==0){
                        if($cid == $menu['id']){
                            if($cid == $menu['id']){
                                ?>
                                <li class="current"><a href="<?php echo $menu['url']?>"><?php echo L('all_product');?><i class="fa fa-caret-up"></i></a></li>
                            <?php }else{ ?>
                                <li><a href="<?php echo $menu['url']?>"><?php echo L('all_product');?><i class="fa fa-caret-up"></i></a></li>
                            <?php
                            }
                        }
                        $category_list = CategoryModel::get_category_sub_list($menu['id']);
                        if($category_list){
                            foreach($category_list as $category){
                                if($category['parentid']==$cid){
                                    ?>
                                    <li><a href="<?php echo $category['url'];?>"><?php echo $category['name'];?><i class="fa fa-caret-up"></i></a></li>
                                <?php
                                }else{
                                    if($cid == $category['id']){
                                        ?>
                                        <li><a href="<?php echo $menu['url']?>"><?php echo L('all_product');?><i class="fa fa-caret-up"></i></a></li>
                                        <?php
                                        $parentid = $category['parentid'];
                                        $sub_categorys = CategoryModel::get_category_sub_list($category['parentid']);
                                        foreach($sub_categorys as $sub_category){
                                            if($cid ==$sub_category['id']){
                                                ?>
                                                <li class="current"><a href="<?php echo $sub_category['url'];?> "><?php echo $sub_category['name'];?><i class="fa fa-caret-up"></i></a></li>
                                            <?php }else{ ?>
                                                <li><a href="<?php echo $sub_category['url'];?> "><?php echo $sub_category['name'];?><i class="fa fa-caret-up"></i></a></li>
                                            <?php
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ?>
        </ul>
    </div>
    <?php
    }
    if($has_parent_id['parentid']){
        $sub_list_1 =  CategoryModel::get_category_sub_list($has_parent_id['parentid']);
    }else{
        $sub_list_1 =  CategoryModel::get_category_sub_list($cid);
    }
    if(count($cat_sub_list) > 1 || count($has_sub_list)){
        ?>
        <div class="sort-mobile js-sort-mobile">
            <div class="view">
                <ul class="clearfix">
                    <?php
                    if($menuList){
                        foreach($menuList as $menu){
                            if($menu['parentid']==0){
                                if($cid == $menu['id']){
                                    if($cid == $menu['id']){
                                        ?>
                                        <li class="item current"><a href="<?php echo $menu['url']?>"><?php echo L('all_product');?><i class="fa fa-caret-up"></i></a></li>
                                    <?php }else{ ?>
                                        <li class="item"><a href="<?php echo $menu['url']?>"><?php echo L('all_product');?><i class="fa fa-caret-up"></i></a></li>
                                    <?php
                                    }
                                }
                                $category_list = CategoryModel::get_category_sub_list($menu['id']);
                                if($category_list){
                                    foreach($category_list as $category){
                                        if($category['parentid']==$cid){
                                            ?>
                                            <li class="item"><a href="<?php echo $category['url'];?>"><?php echo $category['name'];?><i class="fa fa-caret-up"></i></a></li>
                                        <?php
                                        }else{
                                            if($cid == $category['id']) {
                                                ?>
                                                <li class="item"><a href="<?php echo $menu['url']?>"><?php echo L('all_product');?><i class="fa fa-caret-up"></i></a></li>
                                                <?php
                                                $parentid = $category['parentid'];
                                                $sub_categorys = CategoryModel::get_category_sub_list($category['parentid']);
                                                foreach($sub_categorys as $sub_category){
                                                    if($cid ==$sub_category['id']){
                                                        ?>
                                                        <li class="item current"><a href="<?php echo $sub_category['url'];?> "><?php echo $sub_category['name'];?><i class="fa fa-caret-up"></i></a></li>
                                                    <?php }else{ ?>
                                                        <li class="item"><a href="<?php echo $sub_category['url'];?> "><?php echo $sub_category['name'];?><i class="fa fa-caret-up"></i></a></li>
                                                    <?php
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    ?>
                </ul>
            </div>
            <div class="js-trigger">
              <i class="fa fa-chevron-left" data-rel="item"></i>
              <i class="fa fa-chevron-right" data-rel="item"></i>
            </div>
        </div>
    <?php }?>
</div>
<?php include THEMES_PATH.'product/product_list.phtml';?>
<div class="back-top js-back-top"></div>
<?php include THEMES_PATH.'public/footer2.phtml';?>
<?php include THEMES_PATH.'public/after_body.phtml';?>